package com.zzyang.c2c.social.govern.reward.service.impl;

import com.zzyang.c2c.social.govern.reward.api.RewardService;
import com.zzyang.c2c.social.govern.reward.damain.RewardCoin;
import com.zzyang.c2c.social.govern.reward.dao.RewardCoinDAO;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 奖励服务
 *
 * @author zhuoziyang
 * @date 2021/1/25 21:14
 */
@Service(interfaceClass = RewardService.class)
public class RewardServiceImpl implements RewardService {

    @Autowired
    private RewardCoinDAO rewardCoinDAO;

    @Override
    public void rewardReviewers(List<Long> reviewerIds) {
        for (Long reviewerId : reviewerIds) {
            RewardCoin rewardCoin = new RewardCoin();
            rewardCoin.setReviewerId(reviewerId)
                    .setCoins(10);

            rewardCoinDAO.add(rewardCoin);
        }
    }

}
